/*所需用到的对象类*/

/**
 * 直线类型 
 * @returns
 */
function Line() {

	this.setStart_X = function(x) {
		this.start_x = x;
	}
	
	this.setStart_Y = function(y) {
		this.start_y = y;
	} 
		
	this.setEnd_X = function(x) {
		this.end_x = x;
	}
	
	this.setEnd_Y = function(y) {
		this.end_y = y;
	}
		
	this.getStart_X = function() {
		return this.start_x;
	}
	
	this.getStart_Y = function() {
		return this.start_y;
	}
	
	this.getEnd_X = function() {
		return this.end_x;
	}
	
	this.getEnd_Y = function() {
		return this.end_y;
	}
	
	this.setColor = function(color) {
		this.color = color;
	}
	
	this.getColor = function() {
		return this.color;
	}
	
	this.setSize = function(size) {
		this.size = size;
	}
	
	this.draw = function() {
		var canvas = document.getElementById("canvas_content");
		var context = canvas.getContext("2d");
		context.save();
		context.beginPath();
		context.moveTo(this.start_x, this.start_y);
		context.lineTo(this.end_x, this.end_y);
		context.closePath();
		context.strokeStyle = this.color;
		context.lineWidth = this.size;
		context.stroke();
		context.restore();
	}
}

/**
 * 矩形类型
 * @returns
 */
function Rectangle() {
	
	this.setStart_X = function(x) {
		this.start_x = x;
	}
	
	this.setStart_Y = function(y) {
		this.start_y = y;
	} 
		
	this.setWidth = function(width) {
		this.width = width;
	}
	
	this.setHeight = function(height) {
		this.height = height;
	}
	
	this.setBegin_X = function(x) {
		this.begin_x = x;
	}
	
	this.setBegin_Y = function(y) {
		this.begin_y = y;
	}
	
	this.getBegin_X = function() {
		return this.begin_x;
	}
	
	this.getBegin_Y = function() {
		return this.begin_y;
	}
	
	this.getStart_X = function() {
		return this.start_x;
	}
	
	this.getStart_Y = function() {
		return this.start_y;
	}
	
	this.getWidth = function() {
		return this.width;
	}
	
	this.getHeight = function() {
		return this.height;
	}
	
	this.setColor = function(color) {
		this.color = color;
	}
	
	this.getColor = function() {
		return this.color;
	}
	
	this.draw = function() {
		var canvas = document.getElementById("canvas_content");
		var context = canvas.getContext("2d");
		context.save();
		context.strokeStyle = this.color;
		context.lineWidth = 2;
		context.strokeRect(this.begin_x, this.begin_y, this.width, this.height);
		context.restore();
	}
}

/**
 * 圆类型 
 * @returns
 */
function Circle() {
	
	this.setRadius_X = function(x) {
		this.radius_x = x;
	}
	
	this.setRadius_Y = function(y) {
		this.radius_y = y;
	}
	
	this.setRadius = function(radius) {
		this.radius = radius;
	}
	
	this.getRadius_X = function() {
		return this.radius_x;
	}
	
	this.getRadius_Y = function() {
		return this.radius_y;
	}
	
	this.getRadius = function() {
		return this.radius;
	}
	
	this.setColor = function(color) {
		this.color = color;
	}
	
	this.getColor = function() {
		return this.color;
	}
	
	this.draw = function() {
		var canvas = document.getElementById("canvas_content");
		var context = canvas.getContext("2d");
		context.save();
		context.beginPath();
		context.arc(this.radius_x, this.radius_y, this.radius, 0, Math.PI * 2, true);
		context.closePath();
		context.strokeStyle = this.color;
		context.lineWidth = 2;
		context.stroke();
		context.restore();
	}
}

/**
 * 图片类型 
 * @param {Object} start_x
 * @param {Object} start_y
 * @param {Object} width
 * @param {Object} height
 */
function Img(start_x, start_y) {
	this.start_x = start_x;
	this.start_y = start_y;
	this.left_x = start_x;
	this.left_y = start_y;
	this.arc = 0;
	
	this.setStart_X = function(x) {
		this.start_x = x;
	}
	
	this.setStart_Y = function(y) {
		this.start_y = y;
	}
	
	this.setImage = function(image) {
		this.image = image;
	}
	
	this.setWidth = function(width) {
		this.width = width;
	}
	
	this.setHeight = function(height) {
		this.height = height;
	}
	
	this.setArc = function(arc) {
		this.arc = arc;
	}
	
	this.setLeft_X = function(x) {
		this.left_x = x;
	}
	
	this.setLeft_Y = function(y) {
		this.left_y = y;
	}
	
	this.setHorizontal = function(h) {
		this.horizontal = h;
	}
	
	this.setVertical = function(v) {
		this.vertical = v;
	}
	
	this.getStart_X = function() {
		return this.start_x;
	}
	
	this.getStart_Y = function() {
		return this.start_y;
	}
	
	this.getWidth = function() {
		return this.width;
	}
	
	this.getHeight = function() {
		return this.height;
	}
	
	this.getImage = function() {
		return this.image;
	}
	
	this.getArc = function() {
		return this.arc;
	}
	
	this.getLeft_X = function() {
		return this.left_x;
	}
	
	this.getLeft_Y = function() {
		return this.left_y;
	}
	
	this.getHorizontal = function() {
		return this.horizontal;
	}
	
	this.getVertical = function() {
		return this.vertical;
	}
	
	this.draw = function() {
		var canvas = document.getElementById("canvas_content");
		var context = canvas.getContext("2d");
		context.save();
		context.translate(this.start_x, this.start_y);
		context.rotate(this.arc / 180 * Math.PI);
		context.drawImage(this.image, 0, 0, this.width, this.height);
		context.restore();
	}
}
